<!DOCTYPE html>
<html xmlns:th="https://www.thymeleaf.org">

<head>
    <meta charset="utf-8">
    <meta name="referrer" content="no-referrer">
    <title>书架 | Anoyi 主题站</title>
    <link rel="icon" type="image/x-icon" href="https://cdn.anoyi.com/anoyi-favicon.ico">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0/css/bootstrap.css" rel="stylesheet">
    <link href="https://anoyi.cn-sh2.ufileos.com/mdb.css" rel="stylesheet">
    <link href="https://anoyi.cn-sh2.ufileos.com/style.css" rel="stylesheet">
    <link href="https://anoyi.cn-sh2.ufileos.com/toastr.css" rel="stylesheet">
</head>

<body class="creative-lp">

<header>
    <nav th:replace="~{common :: nav}"></nav>
</header>


<div class="view jarallax" data-jarallax='{"speed": 0.2}' style="min-height: unset">
    <img src="https://upload-images.jianshu.io/upload_images/3424642-0af8dd348333e3f5.png" width="100%" style="margin-top: 70px">
    <div class="full-bg-img">
        <div class="mask rgba-black-light">
            <div class="container flex-center">
                <div class="row pt-5 mt-3">
                    <div class="col-md-12 wow fadeIn mb-3">
                        <div class="text-center white-text">
                            <ul class="list-unstyled">
                                <li>
                                    <h5 class="display-4 mt-md-5 mt-md-0 mb-5 font-weight-bold white-text wow fadeIn"
                                        data-wow-delay="0.3s">
                                        <strong>  学而不思则罔，思而不学则殆  </strong>
                                    </h5>
                                    <hr class="hr-light wow fadeInLeft animated" data-wow-delay="0.3s" style="visibility: visible; animation-name: fadeInLeft; animation-delay: 0.3s;">
                                    <h6 class="wow fadeInLeft animated" data-wow-delay="0.3s" style="visibility: visible; animation-name: fadeInLeft; animation-delay: 0.3s;">
                                        所有资源均来自互联网资源分享，若有问题，请联系作者！数据更新时间：2019年09月04日
                                    </h6>
                                </li>
                                <li class="wow fadeIn pt-4" data-wow-delay="0.4s">
                                    <a class="btn pink-gradient btn-rounded btn-lg font-weight-bold"  data-toggle="modal" data-target="#shareModal">共享书籍</a>
                                    <a class="btn pink-gradient btn-rounded btn-lg font-weight-bold" href="/#contract">联系作者</a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- /.Main Container -->
<div class="container">
    <div class="row pt-4">
        <div class="col-lg-12">
            <section class="section pt-4">
                <div class="row">
                    <div class="col-lg-4 col-md-6 mb-4" th:each="book : ${books}">
                        <div class="card card-ecommerce">
                            <div class="view overlay pt-3">
                                <img th:src="${book.cover}" class="mx-auto d-block" alt="" style="max-height: 200px;">
                                <a>
                                    <div class="mask rgba-white-slight"></div>
                                </a>
                            </div>
                            <div class="card-body">
                                <h5 class="card-title mb-1">
                                    <strong>
                                        <a href="" class="dark-grey-text" th:text="${book.name}"></a>
                                    </strong>
                                </h5>
                                <span class="badge badge-info mb-2" th:text="${book.language}"></span>
                                <ul class="rating">
                                    <li th:each="i : ${#numbers.sequence( 1, book.degree)}">
                                        <i class="fa fa-star blue-text"></i>
                                    </li>
                                </ul>
                                <div class="card-footer pb-0">
                                    <div class="row mb-0">
                                        <a th:href="${book.download}" class="btn btn-sm btn-outline-primary" target="_blank"><i
                                                class="fa fa-download"></i> 立即下载</a>
                                        <a th:if="${book.buy}" th:href="${book.buy}" class="btn btn-sm btn-outline-warning" target="_blank"><i
                                                class="fa fa-cart-plus"></i> 购买正版</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </div>
</div>
<!-- /.Main Container -->

<!-- 共享书籍 -->
<div class="modal fade" id="shareModal" tabindex="-1" role="dialog" aria-labelledby="shareModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-notify modal-success" role="document">
        <!--Content-->
        <div class="modal-content">
            <div class="modal-header">
                <p class="heading lead">共享书籍</p>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true" class="white-text">×</span>
                </button>
            </div>
            <div class="modal-body">
                <div class="text-center">
                    <i class="fa fa-check fa-4x mb-3 animated rotateIn"></i>
                    <div class="col-md-12 col-xl-12">
                        <form>
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="md-form">
                                        <div class="md-form">
                                            <input type="text" id="user-name" class="form-control">
                                            <label for="user-name" class="">昵称</label>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="md-form">
                                        <div class="md-form">
                                            <input type="text" id="user-email" class="form-control">
                                            <label for="user-email" class="">微信（方便联系）</label>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-12">
                                    <div class="md-form">
                                        <textarea type="text" id="user-content" class="md-textarea form-control" rows="3"></textarea>
                                        <label for="user-content">资源地址</label>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
            <div class="modal-footer justify-content-center">
                <a type="button" class="btn btn-success waves-effect waves-light" onclick="submitMessage()" data-dismiss="modal">
                    <i class="fa fa-check ml-1"></i>
                    确定
                </a>
                <a type="button" class="btn btn-outline-success waves-effect" data-dismiss="modal">
                    <i class="fa fa-times l-1"></i>
                    取消
                </a>
            </div>
        </div>
    </div>
</div>

<!-- 返回顶部 -->
<section >
    <div class="fixed-action-btn" style="bottom: 45px; right: 24px;">
        <a class="btn-floating btn-lg purple-gradient" style="display:none;" id="goTop">
            <i class="fa fa-arrow-up" aria-hidden="true"></i>
        </a>
    </div>
</section>

<!-- 网站底部 -->
<footer th:replace="~{common :: footer}"></footer>
<!-- /网站底部 -->

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.5.0/js/mdb.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>

<script>
    new WOW().init();

    $(function(){
        $(window).scroll(function(){
            if($(window).scrollTop() > 500){
                $("#goTop").fadeIn(200);
            }
            else{
                $("#goTop").hide(200);
            }
        });
        $("#goTop").click(function(){
            $('html,body').animate({'scrollTop': 0 }, 500);
        });
    });

    /**
     * 用户提交留言
     */
    function submitMessage() {
        var username = $("#user-name").val();
        var email = $("#user-email").val();
        var message = $("#user-content").val();
        if(username.trim().length === 0){
            toastr.error("请填写您的姓名 ！");
            return;
        }
        if(email.trim().length === 0){
            toastr.error("请填写您的微信 ！");
            return;
        }
        if(message.trim().length === 0){
            toastr.error("下载地址不能为空 ！");
            return;
        }
        $.post("/api/common/message",{
            nickname:username,
            email:email,
            content:message
        },function(response){
            if (response.code ===  0){
                $('#user-name').val('');
                $('#user-email').val('');
                $('#user-content').val('');
                toastr.success("感谢您的分享，审核通过后会及时上架！");
            }else {
                toastr.error("发送失败，请用其他方式联系作者！");
            }
        });
        return false;
    }
</script>

</body>
</html>